import java.util.InputMismatchException;
import java.util.Scanner;

public class TestFinally {

    public static int getData(){
        Scanner sc = null;
        try {
            sc = new Scanner(System.in);
            int data = sc.nextInt();
            return data;
        }catch (InputMismatchException e){
            e.printStackTrace();
        }finally {
            if(null != sc){
                sc.close();
            }
            System.out.println("finally中代码");
        }

        System.out.println("try-catch-finally之后代码");

        return 0;
    }

    public static int func4(){
        try {
            return 10;
        }finally {
            return 20;
        }
    }

    public static void main(String[] args) {
        int i = func4();
        System.out.println(i);
    }

    public static void main2(String[] args) {
        int data = getData();
        System.out.println(data);
    }

    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        System.out.println(a);
    }
}
